import minio

minio_conf = {
    'endpoint': '127.0.0.1:9000/',
    'access_key': 'minioadmin',
    'secret_key': 'minioadmin',
    'secure': False
}


def up_data_minio(bucket: str, object_name: str, file_path: str, content_type: str):
    client = minio.Minio(**minio_conf)

    res = client.fput_object(bucket_name=bucket, object_name=object_name,
                             file_path=file_path,
                             content_type=content_type
                             )
    return res


def get_url(method, bucket, object_name):
    client = minio.Minio(**minio_conf)
    url = client.get_presigned_url(
        method,
        bucket,
        object_name,
    )
    return url
